home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / DRIVES.SWG / 0051_Editing the BOOT Sector.pas < prev    next >
Pascal/Delphi Source File  |  1993-11-02  |  1KB  |  41 lines

  1. {
  2. MAYNARD PHILBROOK
  3.  
  4. > How can I look With a pascal-Program(I have TP7.0)in the boot-sector
  5. > of a disk and change them?
  6. }
  7.  
  8. Uses
  9.   Dos;
  10.  
  11. Var
  12.  Sector : Array [1..512] of Byte;
  13.  Regs   : Registers;
  14.  
  15. Function Read_Boot_Sector(Var Drive : Byte) : Boolean;
  16. begin
  17.   With Regs do
  18.   begin
  19.     AH := $02;      { Function Number Read_Sector }
  20.     AL := 1;        { Number of Sectors to Read }
  21.     CH := 1;        { Cylender Number, Upper 2  Bits used For HD }
  22.     CL := 0;        { Bios use Zero base Numbers here }
  23.     DH := 0;        { Head Number or Side 0 = side 1 }
  24.     DL := Drive;    { 0 = A:, 1 := B: Floppys, Add $80 For Fisk Disk }
  25.     ES := Seg(Sector);  { Pass the Address of Buffer }
  26.     BX := Ofs(Sector);
  27.     Intr($13, Regs);    { Call Bios Int ); }
  28.     if Flags and $01 <> 0 Then
  29.       Read_Boot_Sector := False
  30.     else
  31.       Read_Boot_Sector := True;
  32.   end;
  33. end;
  34.  
  35. begin
  36.   if Read_Boot_Sector(0) Then
  37.     WriteLn(' Got it ')
  38.   else
  39.     WriteLn(' Disk Error in reading ');
  40. end.
  41.